/**
 * 
 */
package org.vanbart.flippo;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioButton;

/**
 * A Subclass of {@link RadioButton} where toggle() will reset the checked state if the button is on.
 * The standard RadioButton does not toggle back to an unchecked state.
 * @author ton
 */
public class FlippoView extends RadioButton {
	
	private int size = 100;
	
	// override all inherited constructors
	public FlippoView(Context context) {
		super(context);
		this.setMinHeight(size);
		this.setMinWidth(size);
	}
	
	public FlippoView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.setMinHeight(size);
		this.setMinWidth(size);
	}

	public FlippoView(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.setMinHeight(size);
		this.setMinWidth(size);
	}

	/**
	 * Change the state of the button. For the default RadioButton, calling toggle() on a checked
	 * instance will not reset it. Here we override this behavior.
	 */
	@Override
	public void toggle() {
		setChecked(!isChecked());
	}
	
}
